/*
 * eq.h - 3-band equalizer GUI
 *
 * Copyright (C) 2010-2011 Serge Begger
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef MIXER_H
#define MIXER_H

#include <QWidget>
#include <QSettings>
#include <QSignalMapper>
#include "qcarpcdialog.h"
#include "gst/gst.h"
#include <gst/interfaces/mixer.h>
#include <gst/interfaces/propertyprobe.h>

namespace Ui {
    class mixer;
}

struct mixer_sl_element {
    QString name;
    GstMixerTrack *track;
    int max_vol;
    int curr_vol;
    bool visible;
    int num_ch;
};

struct mixer_sv_element {
    QString name;
    GstMixerTrack *track;
    bool on_off;
    bool visible;
};

class mixer : public QWidget
{
    Q_OBJECT

public:
    explicit mixer(QWidget *parent = 0);
    void EQcurValue(double*);
    ~mixer();
    int speechVolume();
    void setHFMasterValue();
    void retHFMasterValue();

signals:
    void hideWidget();
    void EQSliderValue(double*);

private slots:
    void on_backButton_pressed();
    void on_presetComboBox_currentIndexChanged(int);
    void on_prevButton_pressed();
    void on_nextButton_pressed();
    void on_pushButSpUp_pressed();
    void on_pushButSpDw_pressed();
    void on_pushButHFUp_pressed();
    void on_pushButHFDw_pressed();
    void valueStep(QString);
    void EQvalueChange(int index = 0);

private:
    Ui::mixer *ui;
    QSettings *settings;
    QSignalMapper *mapper;
    //eq
    void EQCreateSliders();
    void EQLinkButtons();
    void EQLoadValue();
    QList<gslider*> *EQSliderList;
    gslider *eqSlider;
    QFrame *frameEQS;
    QList<double> *rockPreset, *classicPreset, *popPreset;
    void EQsetPresetValue();
    //mixer
    GstElement *gst_mixer;
    void initMixer();
    QList<mixer_sl_element> pl_track;
    QList<mixer_sl_element> rec_track;
    QList<mixer_sv_element> svitch_tr;
    QList<gslider*> *mixSliderList;
    gslider *mixSlider, *mixSliderSp, *mixSliderHF;
    QFrame *frameMS;
    void MixCreateSliders();
    void MixLinkButtons();
    void setMixValue(int, int);
    int getMixValue(int);
    int indexMaster,oldMasterValue,newMasterValue;
};

#endif // MIXER_H
